
package sg.edu.nus.iss.cats.dataaccess.mysql;

import sg.edu.nus.iss.cats.model.*;
import sg.edu.nus.iss.cats.dataaccess.*;
import java.sql.*;

public class RoleObjectHandler implements ObjectHandler {

    public String getTableName () {
        return DBConstants.rolesTableName;
    }

    public String getKeyParameterConstraint () {
        return DBConstants.r_roleId + "=?";
    }

    public void setKeyParameters (PreparedStatement statement, Object obj)
                   throws SQLException, DAOException {
        throw new DAOException ("Method setKeyValues not implemented");
    }

    public Object retrieveObject (ResultSet results)
                   throws SQLException, DAOException {
        Role obj = new Role ();
        obj.setRoleId (results.getString(DBConstants.r_roleId));
        obj.setName (results.getString(DBConstants.r_name));
        obj.setDescription (results.getString(DBConstants.r_description));
        return obj;
    }

    public void insertKeys (ResultSet results, Object obj)
                   throws SQLException, DAOException {
        throw new DAOException ("Method insertKeys not implemented");
    }

    public void updateObject (ResultSet results, Object obj)
                   throws SQLException, DAOException {
        throw new DAOException ("Method updateObject not implemented");
    }

    public void completeObjectRetrieve (Object obj) throws DAOException {
    }

    public Object[] getObjectArray (int length) {
        return new Role [length];
    }

}